<?
    /* -*- Mode: PHP5; tab-width: 4; indent-tabs-mode: nil; basic-offset: 4 -*- */
    
    /*********************************************************
    *            --== InArch ==--
    *
    * Ajax Get Page Info action
    *
    * @author Kulikov Alexey <a.kulikov@gmail.com>
    * @version n/a
    * @since 24.05.2005
    * @copyright essentialmind.com 2005
    *
    *********************************************************/

    /***
    * class ajaxGetPageInfo
    ****
    * This class will return page information preformatted
    * by the ajax/nodeinfo.html template.
    ****
    * @package ajax
    * @author A Kulikov <a.kulikov@gmail.com>
    * @version n/a
    * @since 24.05.2005
    * @copyright essentialmind.com 2005
    ***/
    class ajaxGetPageInfo extends ajaxAction{

        function process(){
            $id = (int)$_REQUEST['id'];
            
            if($id == 0){
                return;   
            }
            
            $data = $this->db->getRow("SELECT 
                                                                s.pageurl||'.html' AS url, 
                                                                s.id,
                                                                s.pageid AS pageid,
                                                                s.owner_uid AS uid, 
                                                                ua.login AS uname,
                                                                s.owner_gid AS gid,
                                                                ug.name AS gname, 
                                                                dt.name AS type,
                                                                dt.codeset AS codeset,
                                                                s.title AS title,
                                                                s.created AS intime,
                                                                s.modified AS modtime,
                                                                get_path(s.nodeid)||s.pageurl||'.html' AS path
                                                            FROM pagemap AS s 
                                                            LEFT JOIN datatype AS dt ON s.pagetype = dt.id 
                                                            LEFT JOIN user_access AS ua ON s.owner_uid = ua.id
                                                            LEFT JOIN user_group AS ug ON s.owner_gid = ug.id
                                                            WHERE s.id = $id AND s.version = 1");
            
            $this->smarty->assign("data", $data);

            $controller = adminNodeFactory::cast($data['codeset'],$this->db,$this->smarty,$this->log);
            $this->smarty->assign('sidebarInfo', $controller->sidebarInfo());
   
            //tell smarty, that this is an end page
            $this->smarty->assign("page",true);

            $this->r->html = $this->smarty->preFetch('ajax'.DIRECTORY_SEPARATOR.'nodeinfo.html');
        }      
    }
?>